package com.jsti.ccp.error.exception;


import com.jsti.ccp.error.constants.CcpExceptionConstant;
import lombok.Data;

@Data
public class TicRuntimeException extends RuntimeException {

    /**
     * 异常的CODE码
     */
    private Integer code;

    /**
     * 异常的CODE信息
     */
    private String message;

    /**
     * 拼装message参数
     */
    private Object[] messageArgs;


    public TicRuntimeException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public TicRuntimeException(String message) {
        this.code = CcpExceptionConstant.SERVICE_ERROR_CODE;
        this.message = message;
    }


    public TicRuntimeException(String message, Integer code, String message1, Object[] messageArgs) {
        super(message);
        this.code = code;
        this.message = message1;
        this.messageArgs = messageArgs;
    }

    public TicRuntimeException(String message, Throwable cause, Integer code, String message1, Object[] messageArgs) {
        super(message, cause);
        this.code = code;
        this.message = message1;
        this.messageArgs = messageArgs;
    }

    public TicRuntimeException(Throwable cause, Integer code, String message, Object[] messageArgs) {
        super(cause);
        this.code = code;
        this.message = message;
        this.messageArgs = messageArgs;
    }

    public TicRuntimeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Integer code, String message1, Object[] messageArgs) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.code = code;
        this.message = message1;
        this.messageArgs = messageArgs;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object[] getMessageArgs() {
        return messageArgs;
    }

    public void setMessageArgs(Object[] messageArgs) {
        this.messageArgs = messageArgs;
    }
}
